<?php
	header("Content-Type: text/html;charset=utf-8");
	include("function/_nosql.php"); //
	include("function/function.php");
	include("_include.user.judge.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>会员中心</title>
<link rel="stylesheet" href="css/common.css"/>
<link rel="stylesheet" href="css/sq.css"/>
<script type="text/javascript" src="js/baidutongji.js"></script>
<script type="text/javascript" src="js/laydate/laydate.js"></script>
</head>
<body>
    <!--top-bar begin-->
	<? include("_include.top.topbar.php") ?>
    <!--top-bar end-->
    <!--banner begin-->
    <? include("_include.user.topbar.php")?>
    <!--banner end-->
    <!--member center-->
    <div class="member-box">
        <div class="content">
			<? include("_include.user.leftnav.php") ?>
            <div class="member-box-r">
                <div class="member-item1">
                    <div class="m-title">更改邮箱</div>
                    <?php include_once('_include.user.ordersearch.php');?>
                </div>
                <div class="member-basic">
					<form name="emailform" id="emailform" method="post" action="user_editemailaddsave.php?action=edit">
                    <div class="m-find-box">
                        <ul>
                            <li>
                                <span class="m-l">原邮箱地址：</span>
                                <div class="m-r">
                                    <input name="user_yemail" type="text" class="m-find-input" id="user_yemail" value="<?=$user_email?>" readonly=""/>
                                </div>
                            </li>
                            <li class="mt20">
                                <span class="m-l">新邮箱地址：</span>
                                <div class="m-r">
                                    <input name="user_email" type="text" class="m-find-input" id="user_email"/>
                                    <a class="get-yzm email-yzm" href="alert.getemail.php?action=reg">获取验证码</a>
                                    <div class="m-tips">我们将向该邮箱发送验证码，请在下方输入您收到的验证码</div>
                                </div>
                            </li>
                            <li>
                                <span class="m-l">验证码：</span>
                                <div class="m-r">
                                    <input name="user_emailcode" type="text" class="m-find-input" id="user_emailcode" value="<?=$_SESSION['EmailCode']?>"/>
                                </div>
                            </li>
                            <li class="mt30">
                                <span class="m-l"></span>
                                <div class="m-r">
                                    <input type="submit" name="m-f-btn" class="m-f-btn" value="绑定该邮箱" /><a class="m-f-btn cancel" href="#">取消</a>
                                </div>
                            </li>
                        </ul>
                    </div>
					</form>
                </div>
            </div>
        </div>
    </div>
    <!--member center-->
    <!--foot begin-->
	<? include("_include.bottom.footbar.php") ?>
    <!--foot begin-->
    <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="js/jquery.SuperSlide.2.1.1.js"></script>
    <script type="text/javascript" src="js/main.js"></script>
    <script type="text/javascript" src="js/sq.js"></script>
    <script type="text/javascript" src="layer/layer.js"></script>
    <script type="text/javascript" src="js/alert.js"></script>
	<script language="javascript">
	$(document).ready(function(){
		// 表单提交
		$("#emailform").submit(function(){
			var user_yemail = $("#user_yemail").val();
			var user_email = $("#user_email").val();
			var user_email_rule = /^[0-9a-zA-Z]+@(([0-9a-zA-Z]+)[.])+[a-z]{2,4}$/;
			var user_emailcode = $("#user_emailcode").val();
			
			// 邮箱验证
			if(!user_email_rule.test(user_yemail)){
				alert("原邮箱格式错误！");
				$("#user_yemail").focus();
				return false;
			}
			if(!user_email_rule.test(user_email)){
				alert("邮箱格式错误！");
				$("#user_email").focus();
				return false;
			}
			
			// 验证码验证
			if (user_emailcode.replace(/\ /g,"").length<1){
				alert("请正确输入验证码！");
				$("#user_emailcode").focus();
				return false;
			}
		});
	});
	</script>
</body>
</html>
